<?php

namespace App\Models\MainDB\Erm;

use Illuminate\Database\Eloquent\Model;
use App\Models\MainDB\Erm\ErmGrayList;

class ErmPublicList extends Model{

    protected $table = 'ln_erm_public_list';

    protected $primaryKey = 'id';

    public $timestamps = false;

    public function admin()
    {
        return $this->hasOne('App\Models\MainDB\Admin', 'admin_id', 'operator_id');
    }

    public function erm_authentication_record()
    {
        return $this->hasMany('App\Models\MainDB\Erm\ErmAuthenticationRecord', 'user_id', 'user_id');
    }

    public function erm_gray_list()
    {
        return $this->hasOne('App\Models\MainDB\Erm\ErmGrayList', 'user_id', 'user_id');
    }

    public function erm_white_list()
    {
        return $this->hasOne('App\Models\MainDB\Erm\ErmWhiteList', 'user_id', 'user_id');
    }

    public function erm_black_list()
    {
        return $this->hasOne('App\Models\MainDB\Erm\ErmBlackList', 'user_id', 'user_id');
    }
    public function record(){
        return $this->hasOne(ErmListRecord::class, 'user_id', 'user_id')->orderBy('id', 'desc');
    }

}